Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add yao.component.GetOptions process #771

Merged
merged 1 commit into from
Nov 3, 2024
Merged

Add yao.component.GetOptions process #771

merged 1 commit into from
Nov 3, 2024

Conversation

trheyi
Copy link
Contributor

@trheyi trheyi commented Nov 3, 2024

Usage:

Can be used with components such as Select, AutoComplete, etc.

{
    "Select QueryParam": {
        "bind": "identity",
        "edit": {
          "type": "Select",
          "props": {
            "query": {
              "debug": true, // optional. show the debug information

              // Custom query parameters
              "params": { "name": "{{ name }}", "static": "Hello" }, // optional. custom query parameters. you can use the form data, eg: {{ id }}

              // Specify the field name of the label, value, and icon
              "labelField": "name", // required. the field name of the label
              "valueField": "type", // required. the field name of the value
              "iconField": "icon", // optional. the field name of the icon

              // Query parameters
              "from": "role", // Model name

              // @see QueryParam for more details
              // [[ $keywords ]] is the search keywords, xgen request will be send if the search is enabled
              // [[ $selected ]] is the selected value, the type could be a number, string or an array. xgen request will be send if some options are selected
              "wheres": [
                { "column": "name", "value": "[[ $keywords ]]", "op": "match" }, // if the search is enabled, the query will be executed when the user types in the search box
                {
                  "method": "orwhere",
                  "column": "name",
                  "value": "[[ $keywords ]]"
                } // suggest showing the selected value, if the selected value is not in the search result, it will be added to the search result
              ],
              "limit": 20, // the number of records returned, default is 100. if it's 0, use the default value

              // Format search results
              "labelFormat": "[[ $name ]]-[[ $type ]]", // optional. the format of the label, field name should be add prefix '%'
              "valueFormat": "[[ $type ]]", // optional. the field name of the value should be add prefix '%'
              "iconFormat": "[[ $icon ]]" // optional. the field name of the icon should be add prefix '%'
            }
          }
        }
      },

      "Select QueryDSL": {
        "bind": "identity",
        "edit": {
          "type": "Select",
          "props": {
            "query": {
              "debug": true, // optional. show the debug information

              // Custom query parameters
              "params": { "name": "{{ name }}", "static": "Hello" }, // optional. custom query parameters. you can use the form data, eg: {{ id }}

              // Query DSL
              "engine": "default", // The query engine name, if you want to use queryDSL, this field is required
              "select": ["name as label", "type as value", "icon"], // required. must have label, value and icon fields. icon is optional

              "from": "$role", // required. table name or model name. if it's a model name, should use '$' prefix. eg: '$role'

              // @see QueryDSL for more details
              // You can use the query variables
              // [[ $keywords ]] is the search keywords, xgen request will be send if the search is enabled
              // [[ $selected ]] is the selected value, the type could be a number, string or an array. xgen request will be send if some options are selected
              "wheres": [
                { "field": "name", "match": "[[ $keywords ]]" }, // if the search is enabled, the query will be executed when the user types in the search box
                { "or": true, ":value": "[[ $selected ]]" } // suggest showing the selected value, if the selected value is not in the search result, it will be added to the search result
              ],

              "limit": 20, // the number of records returned, default is 100. if it's 0, use the default value

              // Format search results
              "labelFormat": "[[ $label ]]-[[ $value ]]", // optional. the format of the label, field value should be wrapped with [[ ]] and add prefix '$'
              "valueFormat": "[[ $value ]]", // optional. the field name of the value, field value should be wrapped with [[ ]] and add prefix '$'
              "iconFormat": "[[ $icon ]]" // optional. the field name of the icon, field value should be wrapped with [[ ]] and add prefix '$'
            }
          }
        }
      },
}

@trheyi trheyi merged commit de630d8 into YaoApp:main Nov 3, 2024
1 of 2 checks passed
Copy link

github-actions bot commented Nov 3, 2024

Thank you for the PR! The db: MySQL5.7 redis: 4 mongo: 6.0 test workflow is running, the results of the run will be commented later.

Copy link

github-actions bot commented Nov 3, 2024

Thank you for the PR! The db: MySQL8.0 redis: 6 mongo: 6.0 test workflow is running, the results of the run will be commented later.

Copy link

github-actions bot commented Nov 3, 2024

Thank you for the PR! The db: SQLite3 redis: 6 mongo: 6.0 test workflow is running, the results of the run will be commented later.

Copy link

github-actions bot commented Nov 3, 2024

Thank you for the PR! The db: MySQL5.7 redis: 5 mongo: 6.0 test workflow is running, the results of the run will be commented later.

Copy link

github-actions bot commented Nov 3, 2024

Thank you for the PR! The db: SQLite3 redis: 5 mongo: 6.0 test workflow is running, the results of the run will be commented later.

Copy link

github-actions bot commented Nov 3, 2024

Thank you for the PR! The db: MySQL8.0 redis: 4 mongo: 6.0 test workflow is running, the results of the run will be commented later.

Copy link

github-actions bot commented Nov 3, 2024

Thank you for the PR! The db: MySQL8.0 redis: 5 mongo: 6.0 test workflow is running, the results of the run will be commented later.

Copy link

github-actions bot commented Nov 3, 2024

Thank you for the PR! The db: MySQL5.7 redis: 4 mongo: 6.0 test workflow is running, the results of the run will be commented later.

Copy link

github-actions bot commented Nov 3, 2024

Thank you for the PR! The db: SQLite3 redis: 4 mongo: 6.0 test workflow is running, the results of the run will be commented later.

Copy link

github-actions bot commented Nov 3, 2024

Thank you for the PR! The db: MySQL5.7 redis: 5 mongo: 6.0 test workflow is running, the results of the run will be commented later.

Copy link

github-actions bot commented Nov 3, 2024

Thank you for the PR! The db: SQLite3 redis: 5 mongo: 6.0 test workflow is running, the results of the run will be commented later.

Copy link

github-actions bot commented Nov 3, 2024

Thank you for the PR! The db: MySQL8.0 redis: 6 mongo: 6.0 test workflow is running, the results of the run will be commented later.

Copy link

github-actions bot commented Nov 3, 2024

Thank you for the PR! The db: MySQL8.0 redis: 5 mongo: 6.0 test workflow is running, the results of the run will be commented later.

Copy link

github-actions bot commented Nov 3, 2024

Thank you for the PR! The db: MySQL8.0 redis: 4 mongo: 6.0 test workflow is running, the results of the run will be commented later.

Copy link

github-actions bot commented Nov 3, 2024

Thank you for the PR! The db: SQLite3 redis: 4 mongo: 6.0 test workflow is running, the results of the run will be commented later.

Copy link

github-actions bot commented Nov 3, 2024

Thank you for the PR! The db: MySQL5.7 redis: 6 mongo: 6.0 test workflow is running, the results of the run will be commented later.

1 similar comment
Copy link

github-actions bot commented Nov 3, 2024

Thank you for the PR! The db: MySQL5.7 redis: 6 mongo: 6.0 test workflow is running, the results of the run will be commented later.

Copy link

github-actions bot commented Nov 3, 2024

Thank you for the PR! The db: SQLite3 redis: 6 mongo: 6.0 test workflow is running, the results of the run will be commented later.

Copy link

github-actions bot commented Nov 3, 2024

✨DONE✨ db: SQLite3 redis: 5 mongo: 6.0 passed.

Copy link

github-actions bot commented Nov 3, 2024

✨DONE✨ db: MySQL8.0 redis: 4 mongo: 6.0 passed.

Copy link

github-actions bot commented Nov 3, 2024

✨DONE✨ db: MySQL5.7 redis: 4 mongo: 6.0 passed.

Copy link

github-actions bot commented Nov 3, 2024

✨DONE✨ db: MySQL8.0 redis: 5 mongo: 6.0 passed.

Copy link

github-actions bot commented Nov 3, 2024

✨DONE✨ db: MySQL8.0 redis: 6 mongo: 6.0 passed.

Copy link

github-actions bot commented Nov 3, 2024

✨DONE✨ db: MySQL5.7 redis: 4 mongo: 6.0 passed.

Copy link

github-actions bot commented Nov 3, 2024

✨DONE✨ db: MySQL8.0 redis: 6 mongo: 6.0 passed.

Copy link

github-actions bot commented Nov 3, 2024

✨DONE✨ db: MySQL5.7 redis: 5 mongo: 6.0 passed.

Copy link

github-actions bot commented Nov 3, 2024

✨DONE✨ db: SQLite3 redis: 4 mongo: 6.0 passed.

Copy link

github-actions bot commented Nov 3, 2024

✨DONE✨ db: SQLite3 redis: 6 mongo: 6.0 passed.

Copy link

github-actions bot commented Nov 3, 2024

✨DONE✨ db: MySQL5.7 redis: 6 mongo: 6.0 passed.

Copy link

github-actions bot commented Nov 3, 2024

✨DONE✨ db: MySQL8.0 redis: 4 mongo: 6.0 passed.

Copy link

github-actions bot commented Nov 3, 2024

✨DONE✨ db: SQLite3 redis: 5 mongo: 6.0 passed.

Copy link

github-actions bot commented Nov 3, 2024

✨DONE✨ db: MySQL5.7 redis: 5 mongo: 6.0 passed.

Copy link

github-actions bot commented Nov 3, 2024

✨DONE✨ db: MySQL5.7 redis: 6 mongo: 6.0 passed.

Copy link

github-actions bot commented Nov 3, 2024

✨DONE✨ db: SQLite3 redis: 6 mongo: 6.0 passed.

Copy link

github-actions bot commented Nov 3, 2024

✨DONE✨ db: SQLite3 redis: 4 mongo: 6.0 passed.

Copy link

github-actions bot commented Nov 3, 2024

✨DONE✨ db: MySQL8.0 redis: 5 mongo: 6.0 passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant